<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="utf-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" href="static/layui/css/layui.css">
		<style type="text/css">
			#pageNum {
				width: 20px;
				height: 22px;
				text-align: center;
				border: none;
			}

			#ppp {
				font-size: 14px;
				display: inline-block;
				position: relative;
				top: 5px
			}
		</style>
	</head>
	<body>
		<div id="app">
			<div class="layui-form">
				<table class="layui-table" lay-size="lg">
					<colgroup>
						<col width="100">
						<col width="140">
						<col width="140">
						<col width="140">
						<col width="100">
						<col width="140">
						<col width="140">
						<col width="120">
						<col width="210">
					</colgroup>
					<thead>
						<tr height="60px">

							<th>序号</th>
							<th>用户名</th>
							<th>密码</th>
							<th>昵称</th>
							<th>性别</th>
							<th>生日</th>
							<th>电话</th>
							<th>积分</th>
							<th>操作</th>
						</tr>
					</thead>

					<tbody id="tbd">
						<c:forEach items="${pageBean.data}" var="u">
							<tr>
								<td>${u.id}</td>
								<td>${u.username}</td>
<%--								<td>--%>
<%--									<label id="pwd${u.id}" onclick="changepwd('${u.password}',${u.id})">******</label>--%>
<%--								</td>--%>
									<td id="pwd${u.id}" onclick="changepwd('${u.password}',${u.id})">******</td>
								<td>${u.nickname}</td>
								<td>${u.gender}</td>
								<td>${u.birthday}</td>
								<td>${u.phonenum}</td>
								<td>${u.integral}</td>
								<td>
									<div>
										<button class="layui-btn" >
											<a href="userfindbyid.do?id=${u.id}">
												<i class="layui-icon"></i>
											</a>


										</button>
										<button class="layui-btn layui-btn-danger">
											<a href="userdelete.do?id=${u.id}">
												<i class="layui-icon"></i>
											</a>

										</button>
									</div>
								</td>
							</tr>

						</c:forEach>

					</tbody>
					<tfoot>
						<tr>
							<td colspan="9" align="center">
								<div class="pagelist">
									<div id="ppp">
										第<input id="pageNum" type="text" name="page" size="2" value="${pageBean.currentPage}" />页
									</div>
									<button class="layui-btn layui-btn-sm" >
										<a href="userlist.do?page=${pageBean.currentPage-1 gt 0 ?pageBean.currentPage-1 :1 }">
											上一页
										</a>

									</button>
									<button class="layui-btn layui-btn-sm" >
										<a href="userlist.do?page=${pageBean.currentPage+1 lt pageBean.totalPage ? pageBean.currentPage+1 :pageBean.totalPage }">
											下一页
										</a>
									</button>
								</div>
							</td>
						</tr>
						<tr>
							<td colspan="9" align="center">
								共${pageBean.totalPage}页
							</td>
						</tr>
					</tfoot>
				</table>
			</div>
		</div>
	</body>
	<script type="text/javascript" src="./static/js/jquery-3.4.1.min.js" charset="utf-8"></script>
	<script type="text/javascript" src="./static/layui/layui.js"></script>
	<script>
		function changepwd(pwd,id){
			// console.log(pwd,id);
			// console.log($('#pwd'+id))
			// $('#pwd'+id).innerText=pwd;
			document.getElementById("pwd"+id).innerText=pwd;
			// for (let p in $('.pwd')) {
			// 	console.log(p)
			// }
			//$('.pwd').innerText(pwd);
		}
	</script>
	<c:if test="${not empty msg}">
		<script type="text/javascript">
			window.onload=function (){
				alert("${msg}")
			}
			// $(function (){
			//
			// })

		</script>
	</c:if>
	<script>
			layui.use(['form', 'layedit', 'laydate'], function() {
				var form = layui.form,
					layer = layui.layer,
					layedit = layui.layedit,
					laydate = layui.laydate;
	
				//日期
				laydate.render({
					elem: '#date'
				});
				laydate.render({
					elem: '#date1'
				});
			})
		</script>
</html>
